home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xwator / xwator.h < prev    next >
C/C++ Source or Header  |  1995-05-25  |  3KB  |  114 lines

  1. #include <stdio.h>
  2. #include <X11/StringDefs.h> 
  3. #include <X11/Intrinsic.h> 
  4. #include <Xm/Xm.h> 
  5. #include <Xm/Form.h> 
  6. #include <Xm/PushB.h> 
  7. #include <Xm/DrawingA.h> 
  8. #include <Xm/ToggleB.h> 
  9. #include <X11/Xutil.h>
  10. /* #include "libXs.h" */
  11.  
  12. void     curves(), nocurves();
  13. void     resize();
  14. void     redisplay();
  15. void     quit();
  16. void     start_swimming();
  17. void     stop_swimming();
  18. Boolean  go ();
  19.  
  20. typedef struct {
  21.     int x, y;
  22. } xy_t;
  23.  
  24. typedef struct {
  25.     int left, right, top, bottom;
  26. } lrtb_t;
  27.  
  28. #define WATER    0
  29. #define FISH    1
  30. #define SHARK    2
  31.  
  32. #define MAXPOINTS 4000
  33. #define MAXCOLOR  16
  34.  
  35. #define MARGIN 50
  36.  
  37. struct{
  38.    XPoint  coord[MAXCOLOR][MAXPOINTS];
  39.    int     npoints[MAXCOLOR];
  40. } points;
  41.  
  42. struct{
  43.    XRectangle  coord[MAXCOLOR][MAXPOINTS];
  44.    int     nrects[MAXCOLOR];
  45. } rects;
  46.  
  47. struct wator_cell {
  48.     char creature;    /* creature type WATER, FISH, SHARK        */
  49.     int icon;
  50.     int spec;
  51.     char rate;
  52.     char age;    /* time since creature was born or reproduced    */
  53.     char mv;    /* flag: has creature moved this turn        */
  54.     char ate;    /* time since shark creature ate        */
  55.     char blocked;    /* Flag for blocked in fish            */
  56. } **wator;
  57.  
  58. struct image_data {
  59.   GC           gc[MAXCOLOR];
  60.   Pixmap       pix;
  61.   Dimension    width, height;
  62. } *Data, *Pop, *Fret, *Sret;
  63.  
  64. GC Egc;
  65.  
  66. static char *patterns[] = {     "background",
  67.                 "slant_right",
  68.                 "slant_right",
  69.                 "slant_right",
  70.                 "slant_right",
  71.                 "slant_right",
  72.                 "slant_right",
  73.                 "slant_right",
  74.                 "slant_left",
  75.                 "slant_left",
  76.                 "slant_left",
  77.                 "slant_left",
  78.                 "slant_left",
  79.                 "slant_left",
  80.                 "slant_left",
  81.                 "slant_left",
  82.             };
  83.  
  84. unsigned long shark_icon;
  85. unsigned long fish_icon;
  86. unsigned long water_icon;
  87. int shark_spec=13;
  88. int fish_spec=1;
  89. int water_spec=0;
  90.  
  91. int Eflag=0, Rflag=0, Cflag=0, eflag=0, Pflag=1;
  92. int WRES=1, HRES=1;
  93. int generations=1;
  94. int MAX_X, MAX_Y;
  95. int WIDTH=250;
  96. int HEIGHT=200;
  97. int xoff=0, yoff=0;
  98. int SOMECELLS, AHEAD=50, ALLCELLS, SHARK_START, FISH_START;
  99. int FISH_SPAWN=7, FISH_MUTATE=400, FISH_CRUSH=500, SHARK_SPAWN=10; 
  100. int SHARK_STARVE=2, SHARK_MUTATE=400;
  101.  
  102. extern char *malloc();
  103. char *options[] = {"option1", "option2", "option3"};
  104. Widget framework, canvas, fish_return, shark_return, population, button[4];
  105. XtWorkProcId work_proc_id = (XtWorkProcId)NULL;
  106. Display *dpy = NULL;
  107.  
  108. char color_names[MAXCOLOR][30] = { "black", "red", "green", "blue", "yellow", 
  109.    "magenta", "cyan", "light blue", "pale green", "brown", "gray", 
  110.    "light cyan", "pink", "violet", "firebrick", "white"};
  111.  
  112. unsigned long colors[MAXCOLOR];
  113. int mono=0;
  114.